Work around database corruption reported on WP:VPT -- unlinked title instead of PHP...
authorTim Starling <tstarling@users.mediawiki.org>
Thu, 4 Sep 2008 03:23:42 +0000 (03:23 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Thu, 4 Sep 2008 03:23:42 +0000 (03:23 +0000)
includes/LogPage.php

index 0bc9dd0..4afe3bc 100644 (file)
@@ -155,7 +155,9 @@ class LogPage {
         * @static
         * @return HTML string
         */
-       static function actionText( $type, $action, $title = NULL, $skin = NULL, $params = array(), $filterWikilinks=false ) {
+       static function actionText( $type, $action, $title = NULL, $skin = NULL, 
+               $params = array(), $filterWikilinks=false ) 
+       {
                global $wgLang, $wgContLang, $wgLogActions, $wgMessageCache;
 
                $wgMessageCache->loadAllMessages();
@@ -172,8 +174,15 @@ class LogPage {
 
                                        switch( $type ) {
                                                case 'move':
-                                                       $titleLink = $skin->makeLinkObj( $title, htmlspecialchars( $title->getPrefixedText() ), 'redirect=no' );
-                                                       $params[0] = $skin->makeLinkObj( Title::newFromText( $params[0] ), htmlspecialchars( $params[0] ) );
+                                                       $titleLink = $skin->makeLinkObj( $title, 
+                                                               htmlspecialchars( $title->getPrefixedText() ), 'redirect=no' );
+                                                       $targetTitle = Title::newFromText( $params[0] );
+                                                       if ( !$targetTitle ) {
+                                                               # Workaround for broken database
+                                                               $params[0] = htmlspecialchars( $params[0] );
+                                                       } else {
+                                                               $params[0] = $skin->makeLinkObj( $targetTitle, htmlspecialchars( $params[0] ) );
+                                                       }
                                                        break;
                                                case 'block':
                                                        if( substr( $title->getText(), 0, 1 ) == '#' ) {